package com.wlh.animation.demo;

import com.wlh.animation.view.BottomMenuPopWindow;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.TextView;

/**
 * Created by weilh on 2017/7/3.
 */

public class BottomPopListWindowAct extends AppCompatActivity{

    private BottomMenuPopWindow bottomMenuPopWindow;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView textView = new TextView(this);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showMenu();
            }
        });
        textView.setText("显示菜单");
        setContentView(textView);

    }

    private void showMenu() {
        if (bottomMenuPopWindow == null) {
            bottomMenuPopWindow = new BottomMenuPopWindow(this);
        }
        bottomMenuPopWindow.getListView().setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
                new String[]{"a", "b", "c", "d", "e", "f"}));
        bottomMenuPopWindow.getListView().setMaxItemCount(3);
        bottomMenuPopWindow.showAsDropDown(getWindow().getDecorView());
    }
}
